//
//  SEGSharedCommentModel.m
//  ExcellentHome
//
//  Created by 揭婧雯 on 2017/10/18.
//  Copyright © 2017年 陈区. All rights reserved.
//

#import "SEGSharedCommentModel.h"
#import "SEGSharedCommonUserModel.h"

@implementation SEGSharedCommentModel

- (instancetype)initWithDictionary:(NSDictionary*)dictionary
{
    self = [super init];
    if (self) {
        _comment = [[SEGSharedCommentInfoModel alloc] init];
        _user = [[SEGSharedCommonUserModel alloc] init];
        [self setValuesForKeysWithDictionary:dictionary];
    }
    return self;
}
+ (instancetype)initWithDictionary:(NSDictionary*)dictionary
{
    return [[self alloc] initWithDictionary:dictionary];
}
- (void)setValue:(id)value forKey:(NSString*)key
{
    if ([key isEqualToString:@"user"]) {
        if ([value isKindOfClass:[NSDictionary class]]) {
            _user = [SEGSharedCommonUserModel initWithDictionary:value];
        }
        return;
    }

    if ([key isEqualToString:@"comment"]) {
        if ([value isKindOfClass:[NSDictionary class]]) {
            _comment = [SEGSharedCommentInfoModel initWithDictionary:value];
        }
        return;
    }

    [super setValue:value forKey:key];
}
- (void)setValue:(id)value forUndefinedKey:(NSString*)key
{}

@end
